import * as turf from '@turf/turf'
// 获取多边形中心点
/**
 * list   多边形点集合
 */
export function getCentroid(list) {
    // console.log('7-------',list);
    let save = [];
    list.forEach(obj => {
        console.log(obj);
        save.push([obj.lng,obj.lat])
    });
    save.push([list[0].lng,list[0].lat]);
// 注意：polygon首尾坐标要一致
    var polygon = turf.polygon([save]);

    var centroid = turf.centroid(polygon);
    console.log("......",centroid);
    return centroid
}